import yaml
from base.logger import logger

def my_read_yaml(file, key_word=None):
    """
    读取yaml文件中测试数据方法封装
    :param file:
    :return:
    """
    logger.info("读取yaml文件：{}".format(file))
    with open(file, encoding='utf-8') as f:
        values = yaml.safe_load(f)
    if key_word:
        new_values = []
        for value in values:
            if value.get("key_word") == key_word:
                new_values.append(value)
        return new_values
    else:
        return values


print(my_read_yaml(r"C:\TT\习知\测开\UIdemo\caseData\mail_list_manager\org_test_datas.yaml", key_word="update_org"))